home *** CD-ROM | disk | FTP | other *** search
- This module contains routine(s) that can assist in dealing with INI files for an application.
- Since INI files are suppose to be placed in the Windows directory, I wrote these routines to
- check and see if it exists in the users directory, if it doesn't then I copy a
- default INI from the application directory.
-
- Typical Calling:
-
- Global Declarations
-
- Global Dim gsMsg as String
- Global Dim gsMsgTitle as String
- Global Const gnSuccess = 0
-
- Module Declarations
-
- Dim sProfileName as String
- Dim nReturnStaus as Integer
- '
- ' Build the INI file name
- '
- sProfileName = GetWinDir() & App.EXEName & ".INI"
- '
- ' Check to see if the INI file is in the users
- ' Windows directory. If it is not, then move a
- ' default copy there.
- '
- If FileExists(sProfileName) = False Then
- nReturnStatus = CopyFile(App.Path & "\" & App.EXEName & ".INI", sProfileName)
- If nReturnStatus <> gnSuccess Then
- MsgBox gsMsg, MB_ICONSTOP, gsMsgTitle
- End
- End If
- End If
-
- The following routines exists.
-
- GetWinDir()
- This routine will return a string indicating the users Windows directory
-
- GetWinSysDir()
- This routine will return a string indicating the users Windows System directory
-
- FileExists(Filename)
- This routine will check to see if a file exists.
- This routine accepts a string containing the file name (and optional path)
- This routine will return TRUE if the file exists, False otherwise.
-
- CopyFile(Source, Destination)
- This routine will copy a file from one location to another.
- This routine accepts two strings, source and destination, and accepts no wildcards
- This routine will return the error number if an error occurrs, or 0.
- It will also return a message in the gsMsg and gsMsgTitle strings.
-
- If you have any questions/suggestions, please feel free to drop my an E-Mail
-
- Chad Hegerty
- 71212,1045
-